package com.hdy.web.controller;


import com.hdy.web.dao.LostObjectMapper;
import com.hdy.web.pojo.LostObject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class LostObjectController {
    final LostObjectMapper LostObjectMapper;

    public LostObjectController(LostObjectMapper LostObjectMapper) {
        this.LostObjectMapper = LostObjectMapper;
    }

    @RequestMapping("/cklist")
    public String getAll(Model model){
        List<LostObject> lists = null;
        try {
            lists = LostObjectMapper.getAll();
        } catch (Exception e) {
            return "list";
        }
        model.addAttribute("things", lists);
        return "list";
    }
}
